inherited rstCollectiveMeters: TrstCollectiveMeters
  Left = 221
  Top = 56
  Width = 1024
  Height = 621
  Caption = #1056#1077#1077#1089#1090#1088' '#1086#1073#1097#1080#1093' '#1090#1086#1095#1077#1082' '#1091#1095#1077#1090#1072
  OnActivate = FormActivate
  PixelsPerInch = 96
  TextHeight = 13
  inherited Splitter1: TSplitter
    Left = 749
    Height = 550
  end
  inherited pStatusBar: TStatusBar
    Top = 575
    Width = 1016
  end
  inherited ToolBar1: TToolBar
    Width = 1016
    inherited ToolButton4: TToolButton
      Visible = False
    end
    inherited ToolButton3: TToolButton
      Hint = ''
      Action = nil
      Caption = ''
    end
    inherited ToolButton6: TToolButton
      Visible = False
    end
    object ToolButton15: TToolButton
      Left = 216
      Top = 0
      Action = aPost
    end
    object ToolButton12: TToolButton
      Left = 240
      Top = 0
      Width = 8
      Caption = 'ToolButton12'
      ImageIndex = 8
      Style = tbsSeparator
    end
    object ToolButton13: TToolButton
      Left = 248
      Top = 0
      Hint = #1055#1088#1086#1089#1084#1086#1090#1088' '#1089#1095#1077#1090#1095#1080#1082#1072
      Caption = #1055#1088#1086#1089#1084#1086#1090#1088' '#1089#1095#1077#1090#1095#1080#1082#1072
      ImageIndex = 21
      OnClick = aShowMeterExecute
    end
    object ToolButton14: TToolButton
      Left = 272
      Top = 0
      Width = 8
      Caption = 'ToolButton14'
      ImageIndex = 22
      Style = tbsSeparator
    end
    object Panel4: TPanel
      Left = 280
      Top = 0
      Width = 173
      Height = 23
      BevelOuter = bvNone
      TabOrder = 0
      object cbChargeOnCalc: TDBCheckBoxEh
        Left = 4
        Top = 2
        Width = 166
        Height = 17
        AlwaysShowBorder = True
        Caption = #1056#1072#1089#1095#1080#1090#1072#1090#1100' '#1087#1088#1080' '#1089#1086#1093#1088#1072#1085#1077#1085#1080#1080
        Flat = True
        TabOrder = 0
        ValueChecked = '0'
        ValueUnchecked = '1'
      end
    end
  end
  inherited Panel1: TPanel
    Left = 754
    Height = 550
    inherited TfraAddress1: TfraAddress
      Top = 0
      Height = 250
      inherited SearchBox: TGroupBox
        Height = 250
        Caption = ' '#1060#1080#1083#1100#1090#1088' '
        inherited SubPanel: TPanel
          Height = 233
          inherited Label8: TLabel
            Left = 10
            Top = 33
            Caption = #1059#1089#1083#1091#1075#1072
            Visible = True
          end
          inherited Label6: TLabel
            Left = 3
            Top = 8
            Width = 76
            Alignment = taRightJustify
            Caption = #1053#1072#1079#1074#1072#1085#1080#1077' '#1054#1058#1059
          end
          inherited Label5: TLabel
            Left = 0
            Top = 233
            Alignment = taRightJustify
            Visible = False
          end
          inherited Label4: TLabel
            Left = -21
            Top = 329
            Alignment = taRightJustify
            Visible = False
          end
          inherited Label3: TLabel
            Left = 56
            Top = 113
            Alignment = taRightJustify
          end
          inherited Label2: TLabel
            Left = 47
            Top = 89
            Alignment = taRightJustify
          end
          inherited Label1: TLabel
            Left = 28
            Top = 65
            Alignment = taRightJustify
          end
          inherited TownBox: TDBLookupComboboxEh
            Left = 84
            Top = 62
            Width = 166
            DropDownBox.SpecRow.CellsText = ' ----'
            DropDownBox.SpecRow.Value = '-1'
            DropDownBox.SpecRow.Visible = True
          end
          inherited StreetBox: TDBLookupComboboxEh
            Left = 84
            Top = 86
            Width = 166
          end
          inherited NLSEdit: TDBEditEh
            Left = 84
            Top = 6
            Width = 166
          end
          inherited NameEdit: TDBEditEh
            Left = 32
            Top = 230
            TabOrder = 7
            Visible = False
          end
          inherited HouseBox: TDBLookupComboboxEh
            Left = 84
            Top = 110
            Width = 166
          end
          inherited FindBtn: TButton
            Left = 60
            Top = 197
            Action = aRefresh
            Caption = #1055#1086#1080#1089#1082
            TabOrder = 9
          end
          inherited dbt2: TDBDateTimeEditEh
            TabOrder = 11
          end
          inherited dbt1: TDBDateTimeEditEh
            Top = 160
            TabStop = True
            TabOrder = 6
            Visible = True
          end
          inherited dbn2: TDBNumberEditEh
            Top = 293
            TabOrder = 12
          end
          inherited dbn1: TDBNumberEditEh
            Top = 273
            TabOrder = 13
          end
          inherited dbe2: TDBEditEh
            TabOrder = 14
          end
          inherited dbe1: TDBEditEh
            TabOrder = 15
          end
          inherited ClearBtn: TButton
            Left = 144
            Top = 197
            TabOrder = 10
            OnClick = TfraAddress1ClearBtnClick
          end
          inherited AppartBox: TDBLookupComboboxEh
            Left = 32
            Top = 326
            TabOrder = 8
            Visible = False
          end
          inherited AddBtn: TButton
            Left = 86
            Top = 241
            Width = 0
            Caption = #1057#1086#1093#1088#1072#1085#1080#1090#1100
            TabOrder = 16
            Visible = False
          end
          inherited lcb1: TDBLookupComboboxEh
            Left = 84
            Top = 30
            Width = 166
            TabStop = True
            DropDownBox.SpecRow.CellsText = ' ----'
            DropDownBox.SpecRow.Value = '-1'
            DropDownBox.SpecRow.Visible = True
            KeyField = 'ID'
            ListField = 'NAME'
            ListFieldIndex = 0
            ListSource = dscGroups
            TabOrder = 1
            Visible = True
            OnCloseUp = nil
            OnEnter = nil
            OnKeyPress = nil
          end
          inherited lcb2: TDBLookupComboboxEh
            TabOrder = 17
            OnCloseUp = nil
            OnEnter = nil
            OnKeyPress = nil
          end
          inherited lcb3: TDBLookupComboboxEh
            TabOrder = 18
            OnCloseUp = nil
            OnEnter = nil
            OnKeyPress = nil
          end
          inherited cb1: TDBCheckBoxEh
            Left = 84
            Top = 140
            Width = 166
            AllowGrayed = False
            Caption = #1041#1077#1079' '#1087#1086#1090#1088#1077#1073#1083#1077#1085#1080#1103' '#1079#1072
            TabOrder = 5
            TabStop = True
            Visible = True
            OnClick = TfraAddress1cb1Click
          end
        end
      end
      inherited QStreets: TpFIBDataSet
        Transaction = trList
        UpdateTransaction = trList
      end
      inherited QHouses: TpFIBDataSet
        Transaction = trList
        UpdateTransaction = trList
      end
      inherited QTowns: TpFIBDataSet
        Transaction = trList
        UpdateTransaction = trList
      end
      inherited QApparts: TpFIBDataSet
        SelectSQL.Strings = ()
        Transaction = trList
        UpdateTransaction = trList
      end
    end
    inherited GroupBox1: TGroupBox
      Top = 250
      Height = 0
      Caption = ' '#1044#1086#1087#1086#1083#1085#1080#1090#1077#1083#1100#1085#1099#1081' '#1092#1080#1083#1100#1090#1088' '
      Visible = False
    end
    inherited TfraSubstanceInfo1: TfraSubstanceInfo
      Top = 250
      Height = 300
      inherited TopPanel: TPanel
        Height = 0
      end
      inherited BottomPanel: TPanel
        Top = 300
        Height = 0
      end
      inherited PageControl: TPageControl
        Top = 0
        Height = 300
        inherited TSInfo: TTabSheet
          Caption = ' '#1057#1074#1086#1081#1089#1090#1074#1072' '
          inherited InfoGrid: TDBGridEh
            Height = 269
          end
        end
      end
      inherited QSubstanceInfo: TpFIBDataSet
        SelectSQL.Strings = (
          'SELECT'
          '    RFIELD_NAME as NAME,'
          '    RFIELD_VALUE as VAL'
          'FROM'
          '    PROC_ACCPOINT_GET_PROP_LIST(:RID) ')
        Transaction = trList
        UpdateTransaction = trList
        DataSource = dscRefer
      end
    end
  end
  inherited Panel2: TPanel
    Width = 749
    Height = 550
    inherited Splitter2: TSplitter
      Top = 396
      Width = 749
    end
    inherited GroupBox2: TGroupBox
      Top = 401
      Width = 749
      Caption = ' '#1055#1088#1077#1076#1099#1076#1091#1097#1080#1077' '#1072#1082#1090#1099' '
      inherited DetailGrid: TDBGridEh
        Width = 745
        DataSource = dscDetail
        UseMultiTitle = True
        VTitleMargin = 5
        Columns = <
          item
            EditButtons = <>
            FieldName = 'NAME'
            Footers = <>
          end
          item
            EditButtons = <>
            FieldName = 'ACT_DATE'
            Footers = <>
          end
          item
            EditButtons = <>
            FieldName = 'POTR'
            Footers = <>
          end
          item
            EditButtons = <>
            FieldName = 'BDATE'
            Footers = <>
          end
          item
            EditButtons = <>
            FieldName = 'EDATE'
            Footers = <>
          end
          item
            EditButtons = <>
            FieldName = 'NAME1'
            Footers = <>
          end>
      end
    end
    inherited Panel3: TPanel
      Width = 749
      Height = 396
      inherited dbgRefer: TDBGridEh
        Width = 749
        Height = 396
        AllowedOperations = [alopUpdateEh]
        DrawMemoText = True
        FrozenCols = 5
        IndicatorTitle.TitleButton = True
        Options = [dgEditing, dgTitles, dgColLines, dgRowLines, dgTabs, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit]
        OptionsEh = [dghFixed3D, dghHighlightFocus, dghClearSelection, dghAutoSortMarking, dghMultiSortMarking, dghRowHighlight, dghDblClickOptimizeColWidth, dghDialogFind, dghColumnResize]
        PopupMenu = PopupMenu1
        RowDetailPanel.Active = True
        RowDetailPanel.Height = 97
        RowDetailPanel.BevelInner = bvNone
        RowDetailPanel.BevelKind = bkFlat
        RowDetailPanel.BorderStyle = bsNone
        OnColEnter = dbgReferColEnter
        OnColExit = dbgReferColExit
        OnDblClick = nil
        OnEnter = dbgReferColEnter
        OnKeyUp = dbgReferKeyUp
        Columns = <
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'RPARENT_EXISTS'
            Footers = <>
            ReadOnly = True
            Visible = False
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'RID'
            Footers = <>
            ReadOnly = True
            Visible = False
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'RTOWN'
            Footers = <>
            ReadOnly = True
            Visible = False
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'ADDRESS'
            Footers = <>
            ReadOnly = True
            Visible = False
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'RSERVICE_NAME'
            Footers = <>
            ReadOnly = True
            Width = 190
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'RMANAME'
            Footers = <>
            ReadOnly = True
            Width = 111
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'ID'
            Footers = <>
            ReadOnly = True
            Visible = False
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'METER_NUM'
            Footers = <>
            ReadOnly = True
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'MAX_IND'
            Footers = <>
            ReadOnly = True
            Visible = False
          end
          item
            Color = clInactiveCaptionText
            EditButtons = <>
            FieldName = 'OLD_PH'
            Footers = <>
            ReadOnly = True
          end
          item
            EditButtons = <>
            FieldName = 'NEW_PH'
            Footers = <>
            Width = 70
            OnGetCellParams = dbgReferColumns10GetCellParams
          end
          item
            EditButtons = <>
            EditMask = '!99.99.00;1; '
            FieldName = 'NEW_PH_DATE'
            Footers = <>
            OnGetCellParams = dbgReferColumns10GetCellParams
          end
          item
            EditButtons = <>
            FieldName = 'NEW_POTR'
            Footers = <>
            Width = 78
            OnGetCellParams = dbgReferColumns10GetCellParams
            OnUpdateData = dbgReferColumns12UpdateData
          end
          item
            EditButtons = <>
            FieldName = 'NEW_PZERO'
            Footers = <>
            OnGetCellParams = dbgReferColumns10GetCellParams
          end>
        inherited RowDetailData: TRowDetailPanelControlEh
          object Label1: TLabel
            Left = 8
            Top = 10
            Width = 31
            Height = 13
            Caption = #1040#1076#1088#1077#1089
          end
          object DBEditEh1: TDBEditEh
            Left = 48
            Top = 8
            Width = 209
            Height = 19
            AlwaysShowBorder = True
            DataField = 'RTOWN'
            DataSource = dscRefer
            EditButtons = <>
            Flat = True
            ReadOnly = True
            TabOrder = 0
            Visible = True
          end
          object DBEditEh2: TDBEditEh
            Left = 48
            Top = 32
            Width = 385
            Height = 57
            AlwaysShowBorder = True
            AutoSize = False
            DataField = 'ADDRESS'
            DataSource = dscRefer
            EditButtons = <>
            Flat = True
            ReadOnly = True
            TabOrder = 1
            Visible = True
            WordWrap = True
          end
        end
      end
    end
  end
  inherited shblActionList: TActionList
    Left = 96
    Top = 12
    inherited aInsert: TAction
      Caption = #1047#1072#1085#1077#1089#1090#1080' '#1087#1086#1082#1072#1079#1072#1085#1080#1103' '#1089#1095#1077#1090#1095#1080#1082#1072
      Enabled = False
      Hint = #1047#1072#1085#1077#1089#1090#1080' '#1087#1086#1082#1072#1079#1072#1085#1080#1103' '#1089#1095#1077#1090#1095#1080#1082#1072
      Visible = False
    end
    inherited aEdit: TAction
      Visible = False
    end
    inherited aDelete: TAction
      Visible = False
    end
    inherited aRollback: TAction
      Visible = False
    end
    object aSetActDateToAll: TAction
      Caption = #1042#1099#1089#1090#1072#1074#1080#1090#1100' '#1076#1072#1090#1091' '#1087#1086#1082#1072#1079#1072#1085#1080#1081' '#1087#1086' '#1074#1089#1077#1084
      Hint = #1042#1099#1089#1090#1072#1074#1080#1090#1100' '#1076#1072#1090#1091' '#1089#1085#1103#1090#1080#1103' '#1087#1086#1082#1072#1079#1072#1085#1080#1081' '#1087#1086' '#1074#1089#1077#1084#1091' '#1089#1087#1080#1089#1082#1091
      OnExecute = aSetActDateToAllExecute
    end
  end
  inherited dsRefer: TpFIBDataSet
    SelectSQL.Strings = (
      'select'
      '        p.rid,'
      '        p.rmaname,'
      '        p.rparent_exists,'
      '        p.rtown,'
      '        list(p.houses, chr(13)||chr(10)) as address,'
      '        p.rservice_name,'
      '        p.id,'
      '        p.meter_num,'
      '        p.max_ind,'
      
        '        (select rph from proc_meter_get_ind (p.id, current_date)' +
        ') as old_ph,'
      '        cast(null as numeric(15,3)) as new_ph,'
      '        cast(null as d_sint) as new_pzero,'
      '        cast(null as numeric(15,3)) as new_potr,'
      '        cast(null as d_date) as new_ph_date  '
      ''
      'from'
      '  (select'
      '        rid,'
      '        rmaname,'
      '        rparent_exists,'
      '        rtown,'
      '        rstreet_name||'#39': '#39'||list(rhouse, '#39','#39') as houses,'
      '        rservice_name,'
      '        m.id,'
      '        m.meter_num,'
      '        power(10, mt.capacity) as max_ind'
      '  from proc_v_accpoints ('
      '        :pmaname,'
      '        3,'
      '        :ptown_id,'
      '        :pstreet_id,'
      '        :pbuilding_id,'
      '        :papparts,'
      '        :pletter,'
      '        :pnls,'
      '        :pname,'
      '        1,'
      '        :addparam) p'
      '  left join meters m on m.accpoint_id = p.rid'
      '    and m.meter_status > 0'
      '  left join meter_types mt on mt.id = m.meter_type'
      
        '  group by rid, rmaname, rparent_exists, rtown, rstreet_name, rs' +
        'ervice_name, m.id, m.meter_num, mt.capacity) p'
      'group by 1,2,3,4,6,7,8,9')
    AutoUpdateOptions.KeyFields = 'RID'
    AfterCancel = nil
    AfterEdit = nil
    AfterInsert = nil
    AfterOpen = nil
    BeforeOpen = dsReferBeforeOpen
    AfterRefresh = nil
    Database = MAINDM.pMainDatabase
    AfterFetchRecord = nil
    object dsReferRID: TFIBIntegerField
      DisplayLabel = #1048#1044' '#1058#1059
      FieldName = 'RID'
    end
    object dsReferRMANAME: TFIBStringField
      DisplayLabel = #1053#1072#1079#1074#1072#1085#1080#1077' '#1058#1059
      DisplayWidth = 16
      FieldName = 'RMANAME'
      EmptyStrToNull = True
    end
    object dsReferRPARENT_EXISTS: TFIBIntegerField
      FieldName = 'RPARENT_EXISTS'
    end
    object dsReferRTOWN: TFIBStringField
      DisplayLabel = #1040#1076#1088#1077#1089'|'#1043#1086#1088#1086#1076
      DisplayWidth = 16
      FieldName = 'RTOWN'
      Size = 60
      EmptyStrToNull = True
    end
    object dsReferADDRESS: TFIBMemoField
      DisplayLabel = #1040#1076#1088#1077#1089'|'#1047#1076#1072#1085#1080#1103
      DisplayWidth = 20
      FieldName = 'ADDRESS'
      BlobType = ftMemo
      Size = 8
    end
    object dsReferRSERVICE_NAME: TFIBStringField
      DisplayLabel = #1059#1089#1083#1091#1075#1072
      DisplayWidth = 20
      FieldName = 'RSERVICE_NAME'
      Size = 120
      EmptyStrToNull = True
    end
    object dsReferID: TFIBIntegerField
      DisplayLabel = #1048#1044' '#1089#1095#1077#1090#1095#1080#1082#1072
      FieldName = 'ID'
    end
    object dsReferMETER_NUM: TFIBStringField
      DisplayLabel = #8470' '#1054#1055#1059
      FieldName = 'METER_NUM'
      EmptyStrToNull = True
    end
    object dsReferMAX_IND: TFIBFloatField
      DisplayLabel = #1045#1084#1082#1086#1089#1090#1100' '#1089#1095#1077#1090#1095#1080#1082#1072
      FieldName = 'MAX_IND'
    end
    object dsReferOLD_PH: TFIBBCDField
      DisplayLabel = #1055#1086#1089#1083#1077#1076#1085#1080#1077' '#1087#1086#1082#1072#1079#1072#1085#1080#1103
      FieldName = 'OLD_PH'
      DisplayFormat = '#,##0.000'
      EditFormat = '0.000'
      Size = 3
      RoundByScale = True
    end
    object dsReferNEW_PH: TFIBBCDField
      DisplayLabel = #1047#1072#1103#1074#1083#1077#1085#1085#1099#1077' '#1087#1086#1082#1072#1079#1072#1085#1080#1103
      FieldName = 'NEW_PH'
      DisplayFormat = '#,##0.000'
      EditFormat = '0.000'
      Size = 3
      RoundByScale = True
    end
    object dsReferNEW_PZERO: TFIBSmallIntField
      DisplayLabel = #1055#1077#1088#1077#1093#1086#1076#1086#1074' '#1095#1077#1088#1077#1079' 0'
      FieldName = 'NEW_PZERO'
    end
    object dsReferNEW_POTR: TFIBBCDField
      DisplayLabel = #1047#1072#1103#1074#1083#1077#1085#1085#1086#1077' '#1087#1086#1090#1088#1077#1073#1083#1077#1085#1080#1077
      FieldName = 'NEW_POTR'
      DisplayFormat = '#,##0.000'
      EditFormat = '0.000'
      Size = 3
      RoundByScale = True
    end
    object dsReferNEW_PH_DATE: TFIBDateField
      DisplayLabel = #1044#1072#1090#1072' '#1072#1082#1090#1072
      FieldName = 'NEW_PH_DATE'
      DisplayFormat = 'dd.mm.yyyy'
    end
  end
  inherited dscRefer: TDataSource
    DataSet = mteRefer
    OnDataChange = dscReferDataChange
    Left = 88
  end
  inherited Timer1: TTimer
    OnTimer = Timer1Timer
  end
  inherited PropStorage: TPropStorageEh
    Section = 'TrstCollectiveMeters'
    StoredProps.Strings = (
      '<P>.Height'
      '<P>.Left'
      '<P>.PixelsPerInch'
      '<P>.Top'
      '<P>.Width'
      '<P>.WindowState'
      'Panel2.GroupBox2.<P>.Height'
      'Panel2.GroupBox2.DetailGrid.<P>.Columns.ColumnsIndex'
      'Panel2.GroupBox2.DetailGrid.<P>.Columns.<ForAllItems>.Width'
      'Panel2.Panel3.dbgRefer.<P>.Columns.<ForAllItems>.Width')
    Left = 56
    Top = 12
  end
  object dsDetail: TpFIBDataSet
    SelectSQL.Strings = (
      'select mat.name, maa.act_date, maa.bdate, maa.edate, s.name,'
      
        '       (select sum(mp.potr) from m_act_potr mp where mp.is_delet' +
        'ed = 0 and mp.act_id = maa.id and mp.group_id = ma.group_id) as ' +
        'potr'
      '  from m_accpoint_acts maa'
      '  join m_accpoint ma on ma.id = maa.accpoint_id'
      '    and maa.is_deleted = 0'
      '    and ma.id = :rid'
      '  join m_act_types mat on mat.id = maa.act_type'
      '    and mat.code <> 2'
      '  join services s on s.id = ma.group_id'
      '  order by maa.edate desc')
    Transaction = trList
    Database = MAINDM.pMainDatabase
    DataSource = dscRefer
    Left = 76
    Top = 508
    WaitEndMasterScroll = True
    dcForceOpen = True
    object dsDetailNAME: TFIBStringField
      DisplayLabel = #1058#1080#1087' '#1072#1082#1090#1072
      DisplayWidth = 16
      FieldName = 'NAME'
      Size = 30
      EmptyStrToNull = True
    end
    object dsDetailACT_DATE: TFIBDateField
      DisplayLabel = #1044#1072#1090#1072' '#1072#1082#1090#1072
      FieldName = 'ACT_DATE'
    end
    object dsDetailPOTR: TFIBBCDField
      DisplayLabel = #1055#1086#1090#1088#1077#1073#1083#1077#1085#1080#1077
      DisplayWidth = 14
      FieldName = 'POTR'
      Size = 3
      RoundByScale = True
    end
    object dsDetailBDATE: TFIBDateField
      DisplayLabel = #1055#1077#1088#1080#1086#1076'|'#1089
      FieldName = 'BDATE'
    end
    object dsDetailEDATE: TFIBDateField
      DisplayLabel = #1055#1077#1088#1080#1086#1076'|'#1087#1086
      FieldName = 'EDATE'
    end
    object dsDetailNAME1: TFIBStringField
      DisplayLabel = #1059#1089#1083#1091#1075#1072
      DisplayWidth = 25
      FieldName = 'NAME1'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object dscDetail: TDataSource
    DataSet = dsDetail
    Left = 108
    Top = 508
  end
  object dsGroups: TpFIBDataSet
    SelectSQL.Strings = (
      'select s.id, s.name from services s'
      '  where s.group_id = 0'
      '    and exists (select 1 from dogovors ds, services ss'
      '          where ds.service_id = ss.id and ss.group_id = s.id'
      '            and ds.is_active = 1)'
      '    and exists (select 1 from vw_straits vw'
      '          where vw.code = '#39'CAN_METER'#39' and vw.service_id = s.id)'
      '  order by 2')
    Transaction = trList
    Database = MAINDM.pMainDatabase
    Left = 560
    Top = 231
    object dsGroupsID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsGroupsNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object dscGroups: TDataSource
    DataSet = dsGroups
    Left = 596
    Top = 231
  end
  object PopupMenu1: TPopupMenu
    Images = MAIN.ImageList
    Left = 348
    Top = 219
    object N3: TMenuItem
      Action = aSetActDateToAll
      Caption = #1042#1099#1089#1090#1072#1074#1080#1090#1100' '#1076#1072#1090#1091' '#1072#1082#1090#1072' '#1087#1086' '#1074#1089#1077#1084
      Hint = #1042#1099#1089#1090#1072#1074#1080#1090#1100' '#1076#1072#1090#1091' '#1072#1082#1090#1072' '#1087#1086' '#1074#1089#1077#1084#1091' '#1089#1087#1080#1089#1082#1091
    end
  end
  object mteRefer: TMemTableEh
    FieldDefs = <
      item
        Name = 'RID'
        DataType = ftInteger
      end
      item
        Name = 'RMANAME'
        DataType = ftString
        Size = 20
      end
      item
        Name = 'RPARENT_EXISTS'
        DataType = ftInteger
      end
      item
        Name = 'RTOWN'
        DataType = ftString
        Size = 60
      end
      item
        Name = 'ADDRESS'
        DataType = ftMemo
      end
      item
        Name = 'RSERVICE_NAME'
        DataType = ftString
        Size = 120
      end
      item
        Name = 'ID'
        DataType = ftInteger
      end
      item
        Name = 'METER_NUM'
        DataType = ftString
        Size = 20
      end
      item
        Name = 'MAX_IND'
        DataType = ftFloat
      end
      item
        Name = 'OLD_PH'
        DataType = ftBCD
        Size = 4
      end
      item
        Name = 'NEW_PH'
        DataType = ftBCD
        Size = 4
      end
      item
        Name = 'NEW_PZERO'
        DataType = ftSmallint
      end
      item
        Name = 'NEW_POTR'
        DataType = ftBCD
        Size = 4
      end
      item
        Name = 'NEW_PH_DATE'
        DataType = ftDate
      end>
    IndexDefs = <>
    Params = <>
    StoreDefs = True
    BeforePost = mteReferBeforePost
    Left = 56
    Top = 320
    object mteReferRID: TIntegerField
      DisplayLabel = #1048#1044' '#1058#1059
      FieldName = 'RID'
    end
    object mteReferRMANAME: TStringField
      DisplayLabel = #1053#1072#1079#1074#1072#1085#1080#1077' '#1058#1059
      DisplayWidth = 16
      FieldName = 'RMANAME'
    end
    object mteReferRPARENT_EXISTS: TIntegerField
      FieldName = 'RPARENT_EXISTS'
    end
    object mteReferRTOWN: TStringField
      DisplayLabel = #1040#1076#1088#1077#1089'|'#1043#1086#1088#1086#1076
      DisplayWidth = 16
      FieldName = 'RTOWN'
      Size = 60
    end
    object mteReferADDRESS: TMemoField
      DisplayLabel = #1040#1076#1088#1077#1089'|'#1047#1076#1072#1085#1080#1103
      DisplayWidth = 20
      FieldName = 'ADDRESS'
      BlobType = ftMemo
    end
    object mteReferRSERVICE_NAME: TStringField
      DisplayLabel = #1059#1089#1083#1091#1075#1072
      DisplayWidth = 20
      FieldName = 'RSERVICE_NAME'
      Size = 120
    end
    object mteReferID: TIntegerField
      DisplayLabel = #1048#1044' '#1055#1059
      FieldName = 'ID'
    end
    object mteReferMETER_NUM: TStringField
      DisplayLabel = #8470' '#1054#1055#1059
      DisplayWidth = 15
      FieldName = 'METER_NUM'
    end
    object mteReferMAX_IND: TFloatField
      DisplayLabel = #1045#1084#1082#1086#1089#1090#1100' '#1089#1095#1077#1090#1095#1080#1082#1072
      FieldName = 'MAX_IND'
    end
    object mteReferOLD_PH: TBCDField
      DisplayLabel = #1055#1086#1089#1083#1077#1076#1085#1080#1077' '#1087#1086#1082#1072#1079#1072#1085#1080#1103
      FieldName = 'OLD_PH'
      Size = 0
    end
    object mteReferNEW_PH: TBCDField
      DisplayLabel = #1047#1072#1103#1074#1083#1077#1085#1085#1099#1077' '#1087#1086#1082#1072#1079#1072#1085#1080#1103
      FieldName = 'NEW_PH'
      Size = 0
    end
    object mteReferNEW_PZERO: TSmallintField
      DisplayLabel = #1055#1077#1088#1077#1093#1086#1076#1086#1074' '#1095#1077#1088#1077#1079' 0'
      FieldName = 'NEW_PZERO'
    end
    object mteReferNEW_POTR: TBCDField
      DisplayLabel = #1047#1072#1103#1074#1083#1077#1085#1085#1086#1077' '#1087#1086#1090#1088#1077#1073#1083#1077#1085#1080#1077
      FieldName = 'NEW_POTR'
      Size = 0
    end
    object mteReferNEW_PH_DATE: TDateField
      DisplayLabel = #1044#1072#1090#1072' '#1072#1082#1090#1072
      FieldName = 'NEW_PH_DATE'
    end
  end
  object qNewAct: TpFIBQuery
    Transaction = trCalc
    Database = MAINDM.pMainDatabase
    SQL.Strings = (
      'SELECT'
      '    RACT_ID'
      'FROM'
      '    PROC_ACCPOINT_NEW_ACT(:PACCPOINT_ID,'
      '    :PACT_TYPE,'
      '    :PEDATE,'
      '    :PDOCDATE,'
      '    :PMETER_STR,'
      '    :PMETER_PH_STR,'
      '    :PMETER_ZERO_STR,'
      '    :PPOTR,'
      '    :PBDATE) ')
    Left = 204
    Top = 293
    qoStartTransaction = True
  end
  object qCharge: TpFIBQuery
    Transaction = trCalc
    Database = MAINDM.pMainDatabase
    SQL.Strings = (
      'SELECT count(1)'
      'FROM'
      '    PROC_GEN_CHARGE_METER(:PACT_ID,'
      '    :PDOCDATE, 1) ')
    Left = 236
    Top = 293
    qoStartTransaction = True
  end
  object trCalc: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    TRParams.Strings = (
      'write'
      'nowait'
      'rec_version'
      'read_committed')
    TPBMode = tpbDefault
    Left = 172
    Top = 293
  end
  object dsPhPotr: TpFIBDataSet
    SelectSQL.Strings = (
      'SELECT'
      '    RPOTR'
      'FROM'
      '    PROC_METER_CALC_POTR(:PMETER_ID,'
      '    :PNEW_PH,'
      '    :PZERO,'
      '    coalesce(:PDATE, current_date)) ')
    Transaction = trCalcPotr
    Database = MAINDM.pMainDatabase
    Left = 488
    Top = 183
    object dsPhPotrRPOTR: TFIBBCDField
      FieldName = 'RPOTR'
      Size = 3
      RoundByScale = True
    end
  end
  object trCalcPotr: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    TRParams.Strings = (
      'read'
      'nowait'
      'rec_version'
      'read_committed')
    TPBMode = tpbDefault
    Left = 460
    Top = 183
  end
end
